<?php echo '<?xml version="1.0" encoding="UTF-8"?>';?>
<?php $template = $this->template; ?> 
<template>
    <name><?php echo $template['name']; ?></name>
    <is_active><?php echo $template['is_active']; ?></is_active>
    <default_layout><?php echo $template['default_layout']; ?></default_layout>
    <?php foreach ($template['boxes'] as $box ): ?>
        <box multiple="1">
            <class><?php echo $box['class']; ?></class>
            <block><?php echo $box['block']; ?></block>
            <sortOrder><?php echo $box['sort_order']; ?></sortOrder>
            <config><?php echo $box['config']; ?></config>
            <status><?php echo $box['box_status']; ?></status>
            <?php foreach ($box['pages'] as $page ): ?>
                <page multiple="1">
                    <module><?php echo $page['module']; ?></module>
                    <controller><?php echo $page['controller']; ?></controller>
                    <action><?php echo $page['action']; ?></action>
                    <show><?php echo $page['box_show']; ?></show>
                    <block><?php echo $page['block']; ?></block>
                    <template><?php echo $page['template']; ?></template>
                    <tab_container><?php echo $page['tab_container']; ?></tab_container>
                </page>
            <?php endforeach ?>
        </box>
    <?php endforeach ?>
    <?php foreach ($template['layers'] as $layer ): ?>
        <layer multiple="1">
            <priority><?php echo $layer['priority']; ?></priority>
            <layout><?php echo $layer['layout']; ?></layout>
            <page>
                <module><?php echo $layer['page']['module']; ?></module>
                <controller><?php echo $layer['page']['controller']; ?></controller>
                <action><?php echo $layer['page']['action']; ?></action>
            </page>
        </layer>
    <?php endforeach; ?>
    <?php if (isset($template['cms_block']) && count($template['cms_block'])) :?>
        <?php foreach ($template['cms_block'] as $cmsBlock ): ?>
        <cms_block multiple="1">
            <content><![CDATA[<?php echo $cmsBlock['content']; ?>]]></content>
            <name><?php echo $cmsBlock['name']; ?></name>
            <is_active><?php echo $cmsBlock['is_active']; ?></is_active>
        </cms_block>
        <?php endforeach; ?>
    <?php endif;?>
</template>